package com.xiaotao.mq.controller;

import com.xiaotao.mq.mq.MQSender;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author xt
 * @date 2024/3/20
 * @apiNote
 */
@RestController
public class RabbitMQHandler {
    //装配MQSender
    @Resource
    private MQSender mqSender;

    @Resource
    private RabbitTemplate rabbitTemplate;

    //方法：调用消息生产者，发送消息
    @RequestMapping("/mq")
    public void mq(){
        mqSender.testSend("hello llp",2000);
    }

    @RequestMapping("/cancel")
    @ResponseBody
    public void cancel(){
        //rabbitTemplate.convertAndSend(DelayedMessageConfig.DIRECT_QUEUE,DelayedMessageConfig.DELAYED_EXCHANGE,"");
    }
}
